package org.example.demo.service.common.commonImpl;

import org.example.demo.service.common.ImageService;
import org.springframework.stereotype.Service;

import javax.imageio.ImageIO;
import java.awt.image.BufferedImage;
import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;

@Service
public class ImageServiceImpl implements ImageService {
    final static String baseUrl = "E:\\resource\\";

    public byte[] getImage(String url) throws IOException {
        File file = new File(baseUrl + url);
        FileInputStream fis = new FileInputStream(file);
        byte[] bytes = new byte[fis.available()];
        fis.read(bytes,0,fis.available());
        fis.close();
        return bytes;
    }

}
